void main() {
  // 创建男人对象
  Man man = Man('李雷', 13);
  print(man.name);
  man.eat();
  man.fight();
  man.sing(man.name);

  // 创建女人对象
  Woman woman = Woman('韩梅梅', 14);
  print(woman.name);
  woman.eat();
  woman.dance(woman.name);
}

class Person {
  String? name;
  int? age;

  Person(this.name, this.age);

  void eat() {
    print('$name -- eat');
  }
}

/// 男人类
class Man extends Person with SingMixin {
  // 定义子类构造函数
  Man(super.name, super.age);

  // 定义子类属性
  String gender = '男';

  // 定义子类方法
  void fight() {
    print('$name -- $gender fight');
  }
}

/// 女人类
class Woman extends Person with DanceMixin {
  Woman(super.name, super.age);
}

mixin SingMixin {
  void sing(name) {
    print('$name --- 爱唱歌');
  }
}
mixin DanceMixin {
  void dance(name) {
    print('$name --- 会跳舞');
  }
}
